<?php
my_component_load('testing' , false);
my_component_load('paging' , false);
my_component_load('data_setting', false);
my_component_load('jalur_karir');
$task = isset($_GET['task']) ? $_GET['task'] : ""; 
$id = isset( $_GET['id'] ) ? $_GET['id']:  0;
$jid = isset( $_GET['jid'] ) ? $_GET['jid']:  0;
$mid = isset( $_GET['mid'] ) ? $_GET['mid']:  0;

$kid = isset( $_GET['kid'] ) ? $_GET['kid']:  0;
$jkid = isset( $_GET['jkid'] ) ? $_GET['jkid']:  0;

$modulname = "Admin _BN_ Konfigurasi Data _BN_ Career Path";
if($_SERVER['REQUEST_METHOD'] == "POST" ):
	$validate = form_jalur_karir_move_validate($jid,$mid);
	switch($task){
		case   "create" 	: 
			form_submit_data_jalur_karir($id);
			my_direct( 'index.php?com='.$_GET['com'].'&task=detail_entry_karyawan&id='.$id );
		break;
		case   "edit_move_page" :
			if($validate){
				$errors = message_multi_error($validate);
				$content = $errors;
				$content  .= form_jalur_karir_move($id , $jid ,$mid  ); 
				generate_my_web($content,"","plain.php");
				exit;
			}else{
				submit_jalur_karir_move($id ,$jid , $mid);
				$content="Updated";
				generate_my_web($content, $pagename ,'plain.php' );
				exit;
			}
		break;
		case   "edit_page" 	:
		/*	if($validate){
				$errors = message_multi_error($validate);
				$content = $errors;
				$content  .= form_edit_karir($id , $jid ,$mid  ); 
				generate_my_web($content,"","plain.php");
				exit;
			}else{ */
				form_submit_data_jalur_karir($id);
				$content="Updated";
				generate_my_web($content, $pagename ,'plain.php' );
				exit;
			//}
		break;
	}

else: 
	if($task == "edit_page"){  
		$content  = form_edit_karir( $id ); 
		generate_my_web($content,"","plain.php");
		exit;		
	}elseif($task == 'edit_move_popup'){
		$title= ($id > 0 ) ?  "Perubahan Data" : "Tambah Data";
		facebox_page('index.php?com=jalur_karir&task=edit_move_page&jid='.$jid.'&mid='.$mid.'&id='.$id  , $title , 270	); 
	}elseif($task =="edit_move_page"){ 
		$content  = form_jalur_karir_move($id , $jid ,$mid  ); 
		generate_my_web($content,"","plain.php");
		exit;
	}elseif($task == 'edit_popup'){	
		$title= "Perubahan Data";
		facebox_page('index.php?com=jalur_karir&task=edit_page&id='.$id  , $title , 210	); 
	}elseif($task =="delete"){
		delete_jalur_karir($id);
		my_direct($_SERVER['HTTP_REFERER']);
	}elseif($task =="detail"){
		$pagename = $modulname."  _BN_ Detail";   
		load_facebox_script();
		$view =  jalur_karir_detail($id);
		generate_my_web($view, $pagename );			
		exit;
	}elseif($task =='auto'){
		jalur_karir_auto($id) ;
		my_direct($_SERVER['HTTP_REFERER']);		
	}else{
		$pagename = "Career Path";
		load_facebox_script();
		$view = list_jalur_karir();
		$content = spliter_browser( $view , $pagename ,$href);
		generate_my_web($content, $modulname ); 
	}
endif; 

?>